﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace WebCrawlerTools
{
    public class SLine
    {
        private ArrayList data;

        public ArrayList Data
        {
            get
            {
                return data;
            }
        }
        public SLine()
        {
            data = new ArrayList();
        }

        /// <returns>現在の <see cref="T:System.Object"/> を表す <see cref="T:System.String"/>。</returns>
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();
            for(int i=0 ;i<data.Count;i++)
            {
                bool hasDot= false;
                String item = (String)data[i];
                if (!String.IsNullOrEmpty(item))
                {
                    if (item.IndexOf(",") != -1)
                    {
                        hasDot = true;
                    }
                }
                if (hasDot)
                {
                    sb.Append("\"");
                }
                sb.Append(data[i]);
                if (hasDot)
                {
                    sb.Append("\"");
                }
                if (i != data.Count-1)
                {
                    sb.Append(",");
                }
            }
            return sb.ToString();
        }

    }
}
